package com.chenglu.android.mine.beans.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chenglu.android.R;
import com.chenglu.android.mine.bean.AmountTypeBean;


import java.util.List;

/**
 * @author: lyj
 * @Created: by Copyright 2023/7/24 Guangzhou Hongma Technology Co., Ltd. All rights reserved.
 * @Description：
 */
public class BeansRecordAdapter extends BaseQuickAdapter<AmountTypeBean.Data.Records, BaseViewHolder> {

    public BeansRecordAdapter(int layoutResId, @Nullable List<AmountTypeBean.Data.Records> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, AmountTypeBean.Data.Records item) {
        helper.setText(R.id.tv_remark, item.getRemark());
        helper.setText(R.id.tv_createTime, item.getCreateTime());
        String name = "";
        switch (item.getAmountType()) {//1余额 2积分 3红豆
            case 1:
                name = "余额";
                break;
            case 2:
                name = "积分";
                break;
            case 3:
                name = "红豆";
                break;
        }
        switch (item.getType()) {
            case 1:
                helper.setText(R.id.tv_amount, "+" + item.getAmount());
                helper.setTextColor(R.id.tv_amount, ContextCompat.getColor(mContext,R.color.color_beans_add_text));
                break;
            case 2:
                helper.setText(R.id.tv_amount, "-" + item.getAmount());
                helper.setTextColor(R.id.tv_amount, ContextCompat.getColor(mContext,R.color.color_beans_min_text));
                break;
        }

    }
}
